
import { request } from '@/utils/http'

import type {
hospitalListReqReturnType,
getHosListSearchParamsType,
getProvinceReturnType,
hospitalDetailReturnType,
hosDepartmentListType,
hosScheduleRuleParamsType,
hosScheduleRuleReturnType
} from './model/hospitalListTypes'

//获取医院列表的请求
export const getHospitalListRequest = (page: number, limit: number, searchParams: getHosListSearchParamsType) => {
  return request.get<any, hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`, {
    params: searchParams
  })
}
//搜索请求

//三省联动请求
//省份
export const getProvinceRequest = () => {
  return request.get<any, getProvinceReturnType>(`/admin/cmn/dict/findByDictCode/province`)
}
//市区 
export const getCityOrAreaRequest = (parentId:number) => {
  return request.get<any, getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${parentId}`)
}
//获取医院详情数据请求
//医院详情请求
export const showHospitalDetailRequest = (id:string) => {
  return request.get<any, hospitalDetailReturnType>(`/admin/hosp/hospital/show/${id}`)
}
//上线按钮请求
export const onUnderRequest = (id:string,status:0|1) => {
  return request.get<any, null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}
//医院所有科室的请求
export const hosScheduleListRequest = (hoscode: string) => {
  return request.get<any, hosDepartmentListType>(`/admin/hosp/department/${hoscode}`);
};
//7.某个科室的详细排班时间请求
export const hosScheduleRuleRequest = ({ page, limit, hoscode, depcode }: hosScheduleRuleParamsType) => {
  return request.get<any, hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

